import 'package:json_annotation/json_annotation.dart';

part 'demo_ocr_api.g.dart';

@JsonSerializable(explicitToJson: true)
class ResponseDemoOcrApi {
  final List<FoodItem>? foodJsonCallList;
  final List<RecipeInfo>? recipeInfoVos;

  ResponseDemoOcrApi({
    required this.foodJsonCallList,
    required this.recipeInfoVos,
  });

  factory ResponseDemoOcrApi.fromJson(Map<String, dynamic> json) =>
      _$ResponseDemoOcrApiFromJson(json);

  Map<String, dynamic> toJson() => _$ResponseDemoOcrApiToJson(this);
}

@JsonSerializable()
class FoodItem {
  final String? foodName;
  final List<NutritionalFact>? nutritionalFacts;

  FoodItem({required this.foodName, required this.nutritionalFacts});

  factory FoodItem.fromJson(Map<String, dynamic> json) =>
      _$FoodItemFromJson(json);

  Map<String, dynamic> toJson() => _$FoodItemToJson(this);
}

@JsonSerializable()
class NutritionalFact {
  final String? name;
  final String? num;
  final String? unit;

  NutritionalFact({required this.name, required this.num, required this.unit});

  factory NutritionalFact.fromJson(Map<String, dynamic> json) =>
      _$NutritionalFactFromJson(json);

  Map<String, dynamic> toJson() => _$NutritionalFactToJson(this);
}

@JsonSerializable()
class RecipeInfo {
  final String? id;
  final String? recipeName;
  final bool? isAiRecommend;
  final String? imageIds;
  final String? imageUrls;

  RecipeInfo({
    required this.id,
    required this.recipeName,
    required this.isAiRecommend,
    required this.imageIds,
    required this.imageUrls,
  });

  factory RecipeInfo.fromJson(Map<String, dynamic> json) =>
      _$RecipeInfoFromJson(json);

  Map<String, dynamic> toJson() => _$RecipeInfoToJson(this);
}
